<template>
  <!-- 应答明细信息明细页面弹出框-->
  <el-dialog
    title="小额预对账应答信息明细"
    center
    :visible.sync="open"
    width="1024px"
    :close-on-click-modal="false"
    @close="closeFn"
    append-to-body
  >
    <el-form ref="detailsForm" :model="formData" :rules="rules" label-width="150px" :disabled="true">
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="交易流水号：" prop="id">
            <el-input v-model="formData.id" placeholder="交易流水号" />
          </el-form-item>
        </el-col>
        <el-col :span="12"></el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="工作日期：" prop="workdate">
            <el-date-picker
              v-model="formData.workdate"
              type="date"
              value-format="yyyyMMdd"
              placeholder="选择日期"
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="报文类型：" prop="dtlPkgType">
            <el-select v-model="formData.dtlPkgType" placeholder="请选择" style="width: 100%">
              <el-option
                v-for="dict in dictMap.PKG_TYPE_BEPS_RECON"
                :key="dict.value"
                :label="`${dict.value}-${dict.text}`"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="对账日期：" prop="checkDate">
            <el-date-picker
              v-model="formData.checkDate"
              type="date"
              value-format="yyyyMMdd"
              placeholder="选择日期"
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="来往账标志：" prop="drct">
            <el-select v-model="formData.drct" placeholder="请选择" style="width: 100%">
              <el-option
                v-for="dict in dictMap.DRCTCODE"
                :key="dict.value"
                :label="`${dict.value}-${dict.text}`"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="发起总笔数：" prop="sendCount">
            <el-input v-model="formData.sendCount" placeholder="明细报文标识" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="接收总笔数：" prop="rcvCount">
            <el-input v-model="formData.rcvCount" placeholder="明细报文标识" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="发起总金额货币：" prop="sendCurcd">
            <el-input v-model="formData.sendCurcd" placeholder="明细报文标识" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="接收总金额货币：" prop="rcvCurcd">
            <el-input v-model="formData.rcvCurcd" placeholder="明细报文标识" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="发起总金额：" prop="sendAmount">
            <el-input v-model="formData.sendAmount" placeholder="明细报文标识" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="接收总金额：" prop="rcvAmount">
            <el-input v-model="formData.rcvAmount" placeholder="明细报文标识" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="明细报文标识：" prop="dtlPkgId">
            <el-input v-model="formData.dtlPkgId" placeholder="明细报文标识" />
          </el-form-item>
        </el-col>

        <el-col :span="12">
          <el-form-item label="明细报文类型：" prop="dtlPkgType">
            <el-select v-model="formData.dtlPkgType" placeholder="请选择" style="width: 100%">
              <el-option
                v-for="dict in dictMap.PKG_TYPE_BEPS_RECON"
                :key="dict.value"
                :label="`${dict.value}-${dict.text}`"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="明细发起参与机构：" prop="dtlSender">
            <el-input v-model="formData.dtlSender" placeholder="明细发起参与机构" />
          </el-form-item>
        </el-col>
      </el-row>

      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="Cnaps货币：" prop="cnapsCurcd">
            <el-input v-model="formData.cnapsCurcd" placeholder="Cnaps货币" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="行内货币：" prop="innerCurcd">
            <el-input v-model="formData.innerCurcd" placeholder="行内货币" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="Cnaps金额：" prop="cnapsAmount">
            <el-input v-model="formData.cnapsAmount" placeholder="Cnaps金额" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="行内金额：" prop="innerAmount">
            <el-input v-model="formData.innerAmount" placeholder="行内金额" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="Cnaps保存中心状态：" prop="cnapsSaveStatus">
            <el-select v-model="formData.cnapsSaveStatus" placeholder="请选择" style="width: 100%">
              <el-option
                v-for="dict in dictMap.PROCESSSTATUS"
                :key="dict.value"
                :label="`${dict.value}-${dict.text}`"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="行内保存中心状态：" prop="innerSaveStatus">
            <el-select v-model="formData.innerSaveStatus" placeholder="请选择" style="width: 100%">
              <el-option
                v-for="dict in dictMap.PROCESSSTATUS"
                :key="dict.value"
                :label="`${dict.value}-${dict.text}`"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="对平标志：" prop="checkFlag">
            <el-select v-model="formData.checkFlag" placeholder="请选择" style="width: 100%">
              <el-option
                v-for="dict in dictMap.BAL_SIGN"
                :key="dict.value"
                :label="`${dict.value}-${dict.text}`"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="原对平标志：" prop="oriCheckFlag">
            <el-select v-model="formData.oriCheckFlag" placeholder="请选择" style="width: 100%">
              <el-option
                v-for="dict in dictMap.BAL_SIGN"
                :key="dict.value"
                :label="`${dict.value}-${dict.text}`"
                :value="dict.value"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="接收时间：" prop="rcvTime">
            <el-date-picker
              v-model="formData.rcvTime"
              type="date"
              value-format="yyyyMMdd"
              placeholder="选择时间"
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="proofreadFn" :loading="isLoading">手工校对</el-button>
      <el-button type="primary" @click="closeFn">关闭</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { manualCheck } from "@/api/cnaps/bizMng/beps_pre_reconciliation_query.js";
export default {
  name: "HvpsDetails",
  components: {},
  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
    formData: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      // 是否显示弹出层
      open: false,
      isLoading: false,
      rules: {},
    };
  },
  watch: {
    open(val) {
      if (val) {
      }
    },
  },
  mounted() {},
  methods: {
    // 手工校对方法
    proofreadFn() {
      this.isLoading = true;
      manualCheck(this.formData)
        .then((res) => {
          this.isLoading = false;
          this.$emit("editComplete", true);
          this.msgSuccess("校对成功!");
          this.closeFn();
        })
        .catch((err) => {
          this.isLoading = false;
        });
    },
    // 表单重置
    reset() {
      this.resetForm("detailsForm");
      // this.$set(this, "form", {});
    },
    closeFn() {
      this.open = false;
      this.reset();
    },
    show() {
      this.open = true;
    },
  },
};
</script>
<style lang="scss" scoped></style>
